package com.coocaa.ops.plus.dashboard.v1.codegen.model;

import lombok.Data;

/**
 * @author bijiahao
 * @description
 * @date 2020/7/6 16:06
 */
@Data
public class PiscesTemplateConfigModel extends TemplateConfigModel {

    private String auditTaskProviderImpl;

    private String historyProviderImpl;

    private String rlsUpdateProviderImpl;
    private String rlsUpdateProvider;
    private String historyMapper;
    private String historyXml;
    private String historyTableEntity;

    public PiscesTemplateConfigModel(boolean isOriginTableOnly) {
        this.setBiz("/templates/pisces/common/biz.java.vm");
        this.setMapper("/templates/pisces/common/mapper.java.vm");
        this.setXml("/templates/pisces/common/mapper.xml.vm");
        this.setModel("/templates/pisces/common/model.java.vm");
        this.setUpdateService("/templates/pisces/common/updateService.java.vm");
        this.setUpdateServiceImpl("/templates/pisces/common/updateServiceImpl.java.vm");
        if(isOriginTableOnly){
            this.initForOriginTableOnly();
        }else {
            this.initForCommon();
        }
    }

    private void  initForCommon(){
        this.setEntity("/templates/pisces/common/entity.java.vm");
        this.setBizImpl("/templates/pisces/common/bizImpl.java.vm");
        this.setQueryProvider("/templates/pisces/common/queryProvider.java.vm");
        this.setQueryProviderImpl("/templates/pisces/common/queryProviderImpl.java.vm");
        this.setUpdateProvider("/templates/pisces/common/updateProvider.java.vm");
        this.setUpdateProviderImpl("/templates/pisces/common/updateProviderImpl.java.vm");
        this.setQueryService("/templates/pisces/common/queryService.java.vm");
        this.setQueryServiceImpl("/templates/pisces/common/queryServiceImpl.java.vm");
        this.setController("/templates/pisces/common/controller.java.vm");
    }

    private void initForOriginTableOnly(){
        this.auditTaskProviderImpl = "/templates/pisces/auditTaskProviderImpl.java.vm";
        this.historyProviderImpl = "/templates/pisces/historyProviderImpl.java.vm";
        this.rlsUpdateProviderImpl = "/templates/pisces/rlsUpdateProviderImpl.java.vm";
        this.rlsUpdateProvider = "/templates/pisces/rlsUpdateProvider.java.vm";
        this.historyMapper = "/templates/pisces/historyMapper.java.vm";
        this.historyXml = "/templates/pisces/historyMapper.xml.vm";
        this.historyTableEntity = "/templates/pisces/historyTableEntity.java.vm";
        this.setEntity("/templates/pisces/originTableEntity.java.vm");
        this.setBizImpl("/templates/pisces/originTableBizImpl.java.vm");
        this.setQueryProvider("/templates/pisces/queryProvider.java.vm");
        this.setQueryProviderImpl("/templates/pisces/queryProviderImpl.java.vm");
        this.setUpdateProvider("/templates/pisces/updateProvider.java.vm");
        this.setUpdateProviderImpl("/templates/pisces/updateProviderImpl.java.vm");
        this.setQueryService("/templates/pisces/queryService.java.vm");
        this.setQueryServiceImpl("/templates/pisces/queryServiceImpl.java.vm");
        this.setController("/templates/pisces/controller.java.vm");
    }
}
